//
//  ViewController.swift
//  LeetcodeDemo
//
//  Created by dongchao on 2023/10/12.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        var point = Point(x: 4.0, y: 4.0)
        point.moveBy(x: 6, y: 8)
        print(point)
            
    }
    
}

class DataImporter {
    var fileName = "data.txt"
}

class DataManager {
    lazy var importer = DataImporter()
    var data: [String] = []
}

class Counter {
    var count = 0
    func increment() {
        count += 1
    }
    func increment(by amount: Int) {
        count += amount
    }
    func reset() {
        count = 0
    }
}

struct Point {
    var x = 0.0, y = 0.0
    init(x: Double = 0.0, y: Double = 0.0) {
        self.x = x
        self.y = y
    }
    func isToTheRightOf(x: Double) -> Bool {
        return self.x > x
    }
    
    mutating func moveBy(x deltaX: Double, y deltaY: Double) {
        self = Point(x: x + deltaX, y: y + deltaY)
    }
}

